<html>
  <body>

    <div id="refA"></div>
  </body>
  <script>

function foo(arg) {
    bar = "this is a hidden global variable";
    console.log(bar)
}

foo(1)
var refA = document.getElementById('refA');
document.body.removeChild(refA); // dom删除了
console.log(refA, 'refA'); // 但是还存在引用能console出整个div 没有被回收
// refA = null;
console.log(refA, 'refA'); // 解除引用
  </script>
</html>